package org.sean.framework.schedule.endpoint;

import org.sean.framework.schedule.ScheduleJob;
import org.sean.framework.schedule.server.ScheduleServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 定时任务http调用接口
 *
 * @author xielei
 */
@ControllerEndpoint(id = "jobs")
public class ScheduleJobsEndpoint {
    @Autowired
    ScheduleServer scheduleServer;

    @PostMapping
    @ResponseBody
    public String jobs(@RequestBody ScheduleJob job) {
        return scheduleServer.receive(job);
    }
}
